from typing import TypeVar, Generic

from pandas import DataFrame
import abc

from algorithm.abstract_config import AbstractConfig

T = TypeVar('T', bound=AbstractConfig)


class AbstractAlgorithm(abc.ABC, Generic[T]):

    def __init__(self, conf: T):
        self.config = conf

    '''
     仅返回sn,start_time,end_time
     不用返回:protocol,p_date,fault_code,protocol,detect_time,version,system_type
     返回的为一个二维数组如：
        list = [  
                    [sn001, '2023-01-01 11:11:11', '2023-01-01 14:23:12'],  
                    [sn001, '2023-01-01 18:18:18', '2023-01-01 19:19:19'], 
                    [sn002, '2023-01-02 08:08:08', '2023-01-01 09:09:09'],  
                    [sn003, '2023-01-01 12:01:05', '2023-01-02 04:01:01'], 
                ]
    '''

    @abc.abstractmethod
    def run(self, dataframe: DataFrame) -> list:
        pass
